import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import './assets/styles/compatibility.css'

// Add global accessibility enhancements
import { generateUniqueId } from './utils/accessibility.js'

// Make the ID generator globally available
const app = createApp(App)
app.config.globalProperties.$generateUniqueId = generateUniqueId

// 检查用户是否已登录
const isAuthenticated = localStorage.getItem('isAuthenticated')
if (!isAuthenticated) {
  // 如果未登录，确保路由重定向到登录页面
  router.push('/login')
}

app.use(store)
app.use(router)
app.use(ElementPlus)

app.mount('#app')